package py.org.atom.seam.util;

import org.jboss.seam.contexts.Context;
import org.jboss.seam.contexts.Contexts;

public class ContextUtil {
	
	public static void clean(String name){
		if(name == null)
			return;
		Context ctx = Contexts.getConversationContext();
		String[] objs = ctx.getNames();	
		for(int i=0;i<objs.length;i++){
			if(objs[i] != null 
				&& !objs[i].trim().equals(name.trim())
				&& objs[i].trim().length() > 5 
				&& objs[i].trim().substring(objs[i].trim().length() - 5, objs[i].trim().length()).equals("Admin")){
				ctx.remove(objs[i]);
			}
		}
	}
	
}
